﻿<UserControl x:Class="MemoBoss.Scoreboard"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:local="clr-namespace:MemoBoss"
    mc:Ignorable="d"
    d:DataContext="{d:DesignData ../SampleData/MainViewModelSampleData.xaml}"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    d:DesignHeight="480" d:DesignWidth="480">
    <UserControl.Resources>
        <local:ColorConverter x:Key="colorConverter"></local:ColorConverter>
        <local:VisibilityConverter x:Key="visibilityConverter"></local:VisibilityConverter>
    </UserControl.Resources>
    <Grid x:Name="LayoutRoot">
        <Grid VerticalAlignment="Top"  HorizontalAlignment="Center" Visibility ="{Binding IsDataLoaded, Converter={StaticResource visibilityConverter},ConverterParameter=true}">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Image  Grid.Column="0"  Source="/Images/sl_icon_badge_mdpi.png" Stretch="None" />
            <TextBlock Grid.Column="1"  Margin="20,20,20,20"   FontSize="22" Text="Loading scores..." >
            </TextBlock>
        </Grid>
        <!--<TextBlock Margin="20,20,20,20" VerticalAlignment="Center"  HorizontalAlignment="Center" FontSize="22" Text="Loading scores..." Visibility ="{Binding IsDataLoaded, Converter={StaticResource visibilityConverter},ConverterParameter=true}"></TextBlock>-->
        <Grid  Visibility ="{Binding IsDataLoaded, Converter={StaticResource visibilityConverter},ConverterParameter=false}">
            <Grid.RowDefinitions>
                <RowDefinition Height="auto"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <StackPanel Grid.Row="0" Margin="0,0,0,17"   Orientation="Horizontal">
                <TextBlock Text="Rank" Style="{StaticResource PhoneTextNormalStyle}" FontSize="14" Width="30" HorizontalAlignment="Left"/>
                <TextBlock Text="User name" Style="{StaticResource PhoneTextNormalStyle}" FontSize="14" Width="150" HorizontalAlignment="Left"/>
                <TextBlock Text="Score" Style="{StaticResource PhoneTextSubtleStyle}" FontSize="14"  Width="60"  HorizontalAlignment="Left" TextAlignment="Right"/>
                <TextBlock Text="Level" Style="{StaticResource PhoneTextSubtleStyle}" FontSize="14"  Width="30" HorizontalAlignment="Left"/>
            </StackPanel>
            <ListBox Grid.Row="1"  ItemsSource="{Binding Items}">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Background="{Binding Color, Converter={StaticResource colorConverter}}" >
                            <StackPanel Margin="0,5,0,5" Orientation="Horizontal">
                                <TextBlock Text="{Binding Rank, TargetNullValue='...'}" Style="{StaticResource PhoneTextNormalStyle}" Width="30" VerticalAlignment="Center"/>
                                <TextBlock Text="{Binding User, TargetNullValue='...'}" Style="{StaticResource PhoneTextNormalStyle}"  Width="150" VerticalAlignment="Center"/>
                                <TextBlock Text="{Binding Score, TargetNullValue='...'}"  Style="{StaticResource PhoneTextSubtleStyle}" Width="60" TextAlignment="Right" VerticalAlignment="Bottom" FontFamily="Calibri" FontSize="18" />
                                <TextBlock Text="{Binding Level, TargetNullValue='...'}" Style="{StaticResource PhoneTextSubtleStyle}"  Width="30" VerticalAlignment="Center"/>
                            </StackPanel>
                        </StackPanel>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
        </Grid>
    </Grid>
</UserControl>
